import request from '@/utils/request'

// 新增
export function addRole(params) {
  return request({
    url: '/admin/role/add',
    method: 'post',
    data: params,
  })
}
// 为角色赋值权限
export function assignRole(params) {
  return request({
    url: '/admin/role/assign',
    method: 'post',
    data: params,
  })
}

// 查询所有角色信息  GET
export function findRoleTypes(params) {
  return request({
    url: '/admin/role/findRoleTypes',
    method: 'get',
    params: params,
  })
}
// 查询用户所有角色  GET
export function findUserRole(params) {
  return request({
    url: '/admin/role/findUserRole',
    method: 'get',
    params: params,
  })
}

// 角色切换GET
export function changeRole(params) {
  return request({
    url: '/admin/role/change',
    method: 'get',
    params: params,
  })
}

// 角色删除
export function deleteRole(params) {
  return request({
    url: '/admin/role/delete',
    method: 'post',
    data: params,
  })
}

// GET 查询所有角色接口
export function findAllRole(params) {
  return request({
    url: '/admin/role/findList',
    method: 'get',
    params: params,
  })
}

//  查看详情
export function httpRoleDetail(params) {
  return request({
    url: '/admin/role/findDetail',
    method: 'get',
    params: params,
  })
}

// POST 修改角色接口
export function updateRole(params) {
  return request({
    url: '/admin/role/update',
    method: 'post',
    data: params,
  })
}

// get 根据角色查询所拥有的权限
export function findPermission(params) {
  return request({
    url: '/admin/permission/findPermission',
    method: 'get',
    params: params,
  })
}
